faceroll_textureList = {
  ["current"] = nil,
  ["next"] = nil,
  ["misc"] = nil,
  ["int"] = nil,
  }
  
  local created = false
  
 local timeSinceLastUpdate = 0
 
function faceroll_CreateGUI()

	if (created) then return; end
	
	
	created = true;
	
	
	local displayFrame = CreateFrame("Frame","DKDisplayFrame",UIParent)
	displayFrame:SetFrameStrata("BACKGROUND")
	displayFrame:SetWidth(170)
	displayFrame:SetHeight(90)
	displayFrame:SetBackdrop({
		bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 32,
	})
	displayFrame:SetBackdropColor(0, 0, 0, .4)
	displayFrame:EnableMouse(true)
	displayFrame:SetMovable(true)
	--displayFrame:RegisterForDrag("LeftButton")  --causes right buttont to go crazy, go figure
	displayFrame:SetClampedToScreen(true)
	displayFrame:SetScript("OnMouseDown", function(self) self:StartMoving() end)
	displayFrame:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end)
	displayFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)

	displayFrame:SetPoint("CENTER",-200,-200)

	local displayFrame_current = CreateFrame("Frame","$parent_current", DKDisplayFrame)
	local displayFrame_next = CreateFrame("Frame","$parent_next", DKDisplayFrame)
	local displayFrame_misc = CreateFrame("Frame","$parent_misc", DKDisplayFrame)
	local displayFrame_int = CreateFrame("Frame","$parent_int", DKDisplayFrame)

	displayFrame_current:SetWidth(70)
	displayFrame_next:SetWidth(45)
	displayFrame_misc:SetWidth(45)
	displayFrame_int:SetWidth(35)

	displayFrame_current:SetHeight(70)
	displayFrame_next:SetHeight(45)
	displayFrame_misc:SetHeight(45)
	displayFrame_int:SetHeight(35)

	displayFrame_current:SetPoint("TOPLEFT", 10, -10)
	displayFrame_next:SetPoint("TOPLEFT", 120, -45)
	displayFrame_misc:SetPoint("TOPLEFT", 0, -45)
	displayFrame_int:SetPoint("TOPLEFT", 82, 0)

	local t = displayFrame_next:CreateTexture(nil,"BACKGROUND")
	t:SetTexture(nil)
	t:SetAllPoints(displayFrame_next)
	t:SetAlpha(.8)
	displayFrame_next.texture = t
	faceroll_textureList["next"] = t
  
	t = displayFrame_current:CreateTexture(nil,"BACKGROUND")
	t:SetTexture(nil)
	t:ClearAllPoints()
	t:SetAllPoints(displayFrame_current)
	displayFrame_current.texture = t
	faceroll_textureList["current"] = t

	t = displayFrame_misc:CreateTexture(nil,"BACKGROUND")
	t:SetTexture(nil)
	t:SetAllPoints(displayFrame_misc)
	t:SetAlpha(.8)
	displayFrame_misc:SetFrameLevel(100)
	displayFrame_misc.texture = t
	faceroll_textureList["misc"] = t

	t = displayFrame_int:CreateTexture(nil,"BACKGROUND")
	t:SetTexture(nil)
	t:SetAllPoints(displayFrame_int)
	t:SetAlpha(.8)
	displayFrame_int.texture = t
	faceroll_textureList["int"] = t

	displayFrame:SetScript("OnUpdate", function(this, elapsed)
		faceroll_OnUpdate(elapsed)
	end)

	local cooldownFrame = CreateFrame("Cooldown","$parent_cooldown", DKDisplayFrame_current)
	cooldownFrame:SetHeight(70)
	cooldownFrame:SetWidth(70)
	cooldownFrame:ClearAllPoints()
	cooldownFrame:SetPoint("CENTER", displayFrame_current, "CENTER", 0, 0)

	faceroll_displayFrame = displayFrame
	faceroll_displayFrame_last = displayFrame_last
	faceroll_displayFrame_current = displayFrame_current
	faceroll_displayFrame_next = displayFrame_next
	faceroll_displayFrame_misc =  displayFrame_misc
	faceroll_displayFrame_int =  displayFrame_int
	faceroll_cooldownFrame = cooldownFrame
end

function faceroll_OnUpdate(elapsed)

	timeSinceLastUpdate = timeSinceLastUpdate + elapsed;
  
	if (timeSinceLastUpdate >= 0.9) then
		timeSinceLastUpdate = 0;
		if UnitName("target") == nil or UnitIsFriend("player","target") ~= nil or UnitHealth("target") == 0 then
			return
		else
			faceroll_DecideSpells()
		end
	end
end



